Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Working With Movie Spatial Characteristics

The Movie Toolbox provides a number of functions that allow your application to determine and change the display characteristics of movies and tracks. These functions are discussed in the following sections. Before using any of these functions, you should be familiar with the way in which the Movie Toolbox displays movies. See the discussion of spatial properties in "About Movies" .

You can use the SetMovieGWorld and GetMovieGWorld functions to work with a movie's graphics world. See Inside Macintosh: Imaging for more information about graphics worlds.

Your application can work with a movie's matrix by calling the GetMovieMatrix and  SetMovieMatrix functions, and it can work with a track's matrix with the GetTrackMatrix and SetTrackMatrix functions. Then you can perform operations on matrices with the Movie Toolbox's matrix functions described in "Matrix Functions," .

The following functions affect the displayed movie and its tracks in the final display coordinate system. The SetMovieGWorld and GetMovieGWorld functions let you work with a movie's display destination. The GetMovieBox and SetMovieBox functions allow you to work with a movie's boundary rectangle and its associated transformations. Alternatively, you can use the GetMovieMatrix and SetMovieMatrix functions to work directly with a movie's transformation matrix. The  GetMovieDisplayBoundsRgn function determines a movie's boundary region at the current movie time. On the other hand, the GetMovieSegmentDisplayBoundsRgn function determines a movie's boundary region over a specified time segment. You can use the GetMovieDisplayClipRgn and SetMovieDisplayClipRgn functions to work with a movie's display clipping region.

The GetTrackDisplayBoundsRgn and GetTrackSegmentDisplayBoundsRgn functions determine a track's final boundary region. You can use the GetTrackLayer and SetTrackLayer functions to control the drawing order of tracks within a movie.

A number of functions affect a movie's display boundaries before any display transformations--these functions operate in the movie's display coordinate system. You can use the GetMovieClipRgn and SetMovieClipRgn functions to work with a movie's clipping region--that is, the clipping region that is applied before the movie display transformation. Use the GetMovieBoundsRgn function to determine a movie's boundary region at the current movie time.

Use the GetTrackMovieBoundsRgn function to work with a track's boundary region after matrix transformations have placed the track into the movie's display system. The SetTrackMatrix and GetTrackMatrix functions let you define a track's matrix transformations.

The Movie Toolbox provides several functions that affect a track's display boundaries--these functions operate in the track's display coordinate system before any other display transformations are applied. The GetTrackDimensions and SetTrackDimensions functions allow you to establish a track's coordinate system and to establish a track's source rectangle.

Note
A track's source rectangle defines the coordinate system of the track. You specify the dimensions of the rectangle by providing the coordinates of the lower-right corner of the rectangle. The Movie Toolbox sets the upper-left corner to (0,0) in the track's coordinate system.

You can use the GetTrackBoundsRgn function to determine a track's boundary region. The GetTrackClipRgn and SetTrackClipRgn functions let you work with a track's clipping region. You can use the GetTrackMatte and SetTrackMatte functions to establish a track's matte. The DisposeMatte function allows you to dispose of a matte once you are finished with it.

SetMovieGWorld

Applications use SetMovieGWorld to associate a QuickTime movie with a drawing destination called a GWorld. The SetMovieGWorld function allows your application to establish a movie's display coordinate system by setting the graphics world for displaying a movie.

pascal void SetMovieGWorld (Movie theMovie, CGrafPtr port,
                                          GDHandle gdh);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

port
Points to the movie's graphics port structure or graphics world. Set this parameter to nil to use the current graphics port.

gdh
Contains a handle to the movie's graphics device structure. Set this parameter to nil to use the current device. If the port parameter specifies a graphics world, set this parameter to nil to use that graphics world's graphics device.

DESCRIPTION

The Movie Toolbox automatically sets the graphics world when you create a new movie. Be sure that your application's graphics port is valid or that you specify a valid graphics port with the port parameter. If you pass nil for the port parameter, make sure the current graphics world is valid.

When you use SetMovieGWorld , the Movie Toolbox remembers the current background color and background pattern. These are used for erasing in the default movie uncover function.

SPECIAL CONSIDERATIONS

Applications concerned with playback and rendering performance should call SetMovieGWorld only when necessary. Most applications only call SetMovieGWorld once when a movie is created. Some applications, however, display a single movie in several different windows. These applications must call SetMovieGWorld more than once to ensure that the movie is set to the correct destination. Changing the destination GWorld can be a time-consuming operation, however, so applications should be optimized to avoid unnecessary calls to SetMovieGWorld.

When the movie's GWorld is set, QuickTime needs to rebuild its drawing pipeline. This can require reallocating QuickTime's internal buffers and renegotiating the drawing pipeline with Image Decompressors. This work is not actually done in SetMovieGWorld, but during the next call to MoviesTask, so profiling the calls to QuickTime will only indicate that MoviesTask is taking longer than usual, not that SetMovieGWorld is the cause of the problem.

One of the common mistakes applications make is to call SetMovieGWorld between calls to MoviesTask. In this case, the GWorld being set is always the same. It might seem reasonable to expect QuickTime to ignore calls to SetMovieGWorld when the GWorld isn't being changed. However, because of the way GWorlds are allocated, it is possible to dispose of one GWorld and allocate another with the same address but different properties. Consequently, QuickTime doesn't ignore calls to SetMovieGWorld, even if the address of the GWorld hasn't changed.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can retrieve a movie's graphics world by calling the GetMovieGWorld function, which is described in the next section.

GetMovieGWorld

Your application can determine a movie's graphics world by calling the GetMovieGWorld function.

pascal void GetMovieGWorld (Movie theMovie, CGrafPtr *port,
                                         GDHandle *gdh);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

port
Contains a pointer to a field that is to receive a pointer to a graphics port structure. The Movie Toolbox returns a pointer to the movie's graphics port structure. Set this parameter to nil if you do not want this information.

gdh
Contains a pointer to a field that is to receive a handle to a graphics device structure. The Movie Toolbox returns a handle to the movie's graphics device structure. Set this parameter to nil if you do not want this information.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can set a movie's graphics world by calling the SetMovieGWorld function, which is described in the previous section.

SetMovieBox

The SetMovieBox function sets a movie's boundary rectangle, or movie box, which is a rectangle that encompasses the spatial representation of all of the movie's enabled tracks. The movie box is in the display coordinate system.

pascal void SetMovieBox (Movie theMovie, const Rect *boxRect);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

boxRect
Contains a pointer to a rectangle that contains the coordinates of the new boundary rectangle.

DESCRIPTION

The Movie Toolbox changes the rectangle by modifying the translation and scale values of the movie's matrix to accommodate the new boundary rectangle.

The movie box might not have its upper-left corner set at (0,0) in its display window when the movie is first loaded. Consequently, your application may need to adjust the position of the movie box so that it appears in the appropriate location within your application's document window. If you don't reset the movie position, the movie might not be visible when it starts playing.

The following sample code demonstrates how to move the boundary rectangle.

GetMovieBox (movie, &movieBox);
OffsetRect (&movieBox, -movieBox.left, -movieBox.top);
SetMovieBox (movie, &movieBox);

SPECIAL CONSIDERATIONS

The SetMovieBox function does not call your cover functions.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

You can modify the movie's matrix directly by calling the SetMovieMatrix function, which is described on SetMovieMatrix . You can retrieve a movie's boundary rectangle by calling the GetMovieBox function, which is described in the next section.

GetMovieBox

The GetMovieBox function returns a movie's boundary rectangle, which is a rectangle that encompasses all of the movie's enabled tracks. The movie box is in the coordinate system of the movie's graphics world and defines the movie's boundaries over the entire duration of the movie. The movie's boundary rectangle defines the size and shape of the movie before the Movie Toolbox applies the display clipping region.

pascal void GetMovieBox (Movie theMovie, Rect *boxRect);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

boxRect
Contains a pointer to a rectangle. The GetMovieBox function returns the coordinates of the movie's boundary rectangle into the structure referred to by this parameter.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

You can use the SetMovieBox function, which is described in the previous section, to change the coordinates of a movie's boundary rectangle.

GetMovieDisplayBoundsRgn

The GetMovieDisplayBoundsRgn function allows your application to determine a movie's display boundary region. The display boundary region encloses all of a movie's enabled tracks after the track matrix, track clip, movie matrix, and movie clip have been applied to all of the movie's tracks. This region is in the display coordinate system of the movie's graphics world. The movie's boundary rectangle encloses this region. For more on boundary regions and matrices for movies and tracks, see "Spatial Properties," which begins on Spatial Properties .

pascal RgnHandle GetMovieDisplayBoundsRgn (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The Movie Toolbox derives the display boundary region only from enabled tracks, and only from those tracks that are used in the current display mode (that is, movie, poster, or preview). The display boundary region is valid for the current movie time.

The GetMovieDisplayBoundsRgn function allocates the region and returns a handle to the region. Your application must dispose of this handle when you are done with it. If the movie does not have a spatial representation at the current movie time, the function returns an empty region. If the function could not satisfy your request, it sets the returned handle to nil .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

If you want to determine the boundary region that applies to a time segment of a movie, you can use the GetMovieSegmentDisplayBoundsRegion function, which is described in the next section.

GetMovieSegmentDisplayBoundsRgn

The GetMovieSegmentDisplayBoundsRgn function allows your application to determine a movie's display boundary region during a specified segment. The display boundary region encloses all of a movie's enabled tracks after the track matrix, track clip, movie matrix, and movie clip have been applied to all of the movie's tracks. This region is in the display coordinate system. The movie's boundary encloses this region. For more on boundary regions and matrices for movies and tracks, see "Spatial Properties," which begins on Spatial Properties .

pascal RgnHandle GetMovieSegmentDisplayBoundsRgn (Movie theMovie,
                                         TimeValue time,
                                         TimeValue
                                         duration);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

time
Specifies the starting time of the movie segment to consider. This time value must be expressed in the movie's time coordinate system. The duration parameter specifies the length of the segment.

duration
Specifies the length of the segment to consider. Set this parameter to 0 to specify an instant in time.

DESCRIPTION

The Movie Toolbox derives the display boundary region only from enabled tracks and only from those tracks that are used in the current display mode (that is, movie, poster, or preview). If you want to determine the boundary region that applies to the current movie time, you can use GetMovieDisplayBoundsRegion , which is described in the previous section.

The GetMovieSegmentDisplayBoundsRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the movie does not have a spatial representation during the specified segment, the function returns an empty region. If the function could not satisfy your request, it sets the returned handle to nil .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidDuration

-2014

This duration value is invalid

invalidTime

-2015

This time value is invalid

Memory Manager errors

SetMovieDisplayClipRgn

The SetMovieDisplayClipRgn function allows your application to establish a movie's current display clipping region.

pascal void SetMovieDisplayClipRgn (Movie theMovie,
                                         RgnHandle theClip);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

theClip
Contains a handle to the movie's display clipping region. Note that the Movie Toolbox makes a copy of this region. Your application must dispose of the region referred to by this parameter when you are done with it. Set this parameter to nil to disable a movie's clipping region.

DESCRIPTION

The display clipping region defines any final clipping that is applied to the movie before it is displayed, and it is valid for the entire duration of the movie. You must use this region to clip a movie because the Movie Toolbox ignores the clip region of the movie's graphics world during display processing.

Note that the display clipping region is not saved with the movie.

SPECIAL CONSIDERATIONS

Do not use the SetMovieDisplayClipRgn function when you are using a movie controller component--use the movie controller component function MCSetClip instead. For details on the MCSetClip function, see the chapter "Movie Controller Components" in Inside Macintosh: QuickTime Components.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

You can retrieve the display clipping region by calling the GetMovieDisplayClipRgn function, which is described in the next section.

GetMovieDisplayClipRgn

The GetMovieDisplayClipRgn function allows your application to determine a movie's current display clipping region.

pascal RgnHandle GetMovieDisplayClipRgn (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The display clipping region defines the final clipping that is applied to the movie before it is displayed. The display clipping region is valid for the entire duration of the movie.

Note that the display clipping region is not saved with the movie.

The GetMovieDisplayClipRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the function could not satisfy your request or if there is no display clipping region defined for the movie, the function sets the returned handle to nil .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

You can set the display clipping region by calling the SetMovieDisplayClipRgn function, which is described in the previous section.

GetTrackDisplayBoundsRgn

The GetTrackDisplayBoundsRgn function allows your application to determine the region a track occupies in a movie's graphics world.

pascal RgnHandle GetTrackDisplayBoundsRgn (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

This region is in the display coordinate system. This region, when intersected with the movie's display clipping region, describes which pixels in the movie's graphics world display information from the specified track. This region is valid for the current movie time.

The GetTrackDisplayBoundsRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the track does not have a spatial representation at the current movie time, the function returns an empty region. If the function could not satisfy your request, it sets the returned handle to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

Memory Manager errors

SEE ALSO

If you want to determine the track's boundary region over a specified time segment, you can use the GetTrackSegmentDisplayBoundsRgn function, which is described in the next section.

GetTrackSegmentDisplayBoundsRgn

The GetTrackSegmentDisplayBoundsRgn function allows your application to determine the region a track occupies in a movie's graphics world during a specified segment.

pascal RgnHandle GetTrackSegmentDisplayBoundsRgn (Track theTrack,
                                         TimeValue time,
                                         TimeValue duration);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

time
Specifies the starting time of the track segment to consider. This time value must be expressed in the movie's time coordinate system. The duration parameter specifies the length of the segment.

duration
Specifies the length of the segment to consider. Set this parameter to 0 to consider an instant in time.

DESCRIPTION

This region is in the display coordinate system. When combined with the movie's display clipping region, this region describes which pixels in the movie's graphics world display information from the specified track.

This region is valid for the specified segment.

The GetTrackSegmentDisplayBoundsRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the track does not have a spatial representation during the specified segment, the function returns an empty region. If the function could not satisfy your request, it sets the returned handle to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

invalidDuration

-2014

This duration value is invalid

invalidTime

-2015

This time value is invalid

Memory Manager errors

SEE ALSO

If you want to determine the track's boundary region for the current movie time, you can use the GetTrackDisplayBoundsRgn function, which is described in the previous section.

SetTrackLayer

The SetTrackLayer function allows your application to set a track's layer.

pascal void SetTrackLayer (Track theTrack, short layer);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

layer
Specifies the track's layer number. Layers are numbered from -32,768 through 32,767. When you create a new track, the Movie Toolbox sets its track number to 0.

DESCRIPTION

Track layers are numbered from -32,768 through 32,767. You can use layers to control how tracks are combined to create a movie. The Movie Toolbox displays layers by layer number. That is, the Movie Toolbox displays higher-numbered layers first, placing lower-numbered layers on top of them. If your movie has more than one track in the same layer, the Movie Toolbox displays those layers in order by track index value, displaying higher-numbered tracks first.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SEE ALSO

You can retrieve a track's layer number by calling the GetTrackLayer function, which is described in the next section.

GetTrackLayer

The GetTrackLayer function allows your application to retrieve a track's layer.

pascal short GetTrackLayer (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackLayer function returns an integer that contains the track's layer number. Tracks are numbered from -32,768 through 32,767. You can use layers to control how tracks are combined to create a movie. The Movie Toolbox displays layers by layer number. That is, the Movie Toolbox displays higher-numbered layers first, placing lower-numbered layers on top of them. If your movie has more than one track in the same layer, the Movie Toolbox displays those layers in order by track index value, displaying higher-numbered tracks first.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SEE ALSO

You can set a track's layer number by calling the SetTrackLayer function, which is described in the previous section.

SetMovieMatrix

The SetMovieMatrix function allows your application to set a movie's transformation matrix. The Movie Toolbox uses a movie's matrix to map a movie from its display coordinate system to its graphics world. You can retrieve a movie's matrix with the GetMovieMatrix function, which is described in the next section.

pascal void SetMovieMatrix (Movie theMovie,
                                         const MatrixRecord *matrix);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

matrix
Contains a pointer to the matrix structure for the movie. If you set this parameter to nil , the Movie Toolbox uses the identity matrix.

SPECIAL CONSIDERATIONS

The SetMovieMatrix function does not call your cover functions.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

The Movie Toolbox provides a number of functions that allow you to manipulate movie matrices. See "Matrix Functions," which begins on Matrix Functions , for information about these functions.

GetMovieMatrix

The GetMovieMatrix function allows your application to retrieve a movie's transformation matrix.

pascal void GetMovieMatrix (Movie theMovie, MatrixRecord *matrix);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

matrix
Contains a pointer to a matrix structure. The GetMovieMatrix function returns the movie's matrix into the structure referred to by this parameter.

DESCRIPTION

The Movie Toolbox uses a movie's matrix to map a movie from its coordinate system to the display coordinate system.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can set a movie's matrix with the SetMovieMatrix function, which is described in the previous section.

The Movie Toolbox provides a number of functions that allow you to manipulate movie matrices. See "Matrix Functions," which begins on Matrix Functions , for information about these functions.

GetMovieBoundsRgn

The GetMovieBoundsRgn function allows your application to determine a movie's boundary region.

pascal RgnHandle GetMovieBoundsRgn (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The movie boundary region encloses all of a movie's tracks after the union of the track clip and the track matrix has been applied to all the movie's tracks (but not to the movie itself). This region is in the movie's display coordinate system.

The Movie Toolbox derives the boundary region only from enabled tracks, and only from those tracks that are used in the current display mode (that is, movie or preview). The boundary region is valid for the current movie time.

The GetMovieBoundsRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the movie does not have a spatial representation at the current time, the function returns an empty region. If the function could not satisfy your request, it sets the returned handle to  nil .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

GetTrackMovieBoundsRgn

The GetTrackMovieBoundsRgn function allows your application to determine the region the track occupies in a movie's boundary region. This region is in the display coordinate system of the movie. The Movie Toolbox determines this region by applying the track's clipping region and matrix. This region is valid only for the current movie time.

pascal RgnHandle GetTrackMovieBoundsRgn (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackMovieBoundsRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the track does not have a spatial representation at the current movie time, the function returns an empty region. If the function could not satisfy your request, it sets the returned handle to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SetMovieClipRgn

The SetMovieClipRgn function allows your application to establish a movie's clipping region.

pascal void SetMovieClipRgn (Movie theMovie, RgnHandle theClip);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

theClip
Contains a handle to the movie's clipping region. Note that the Movie Toolbox makes a copy of this region. Your application must dispose of the region referred to by this parameter when you are done with it. Set this parameter to nil to disable clipping for the movie.

DESCRIPTION

The clipping region defines any clipping that is applied to the movie before it is mapped to its graphics world by applying the movie's matrix. The clipping region is in the movie's display coordinate system.

The clipping region is saved with the movie.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

You can retrieve the clipping region by calling the GetMovieClipRgn function, which is described in the next section.

GetMovieClipRgn

The GetMovieClipRgn function allows your application to determine a movie's clipping region.

pascal RgnHandle GetMovieClipRgn (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The clipping region defines any clipping that is applied to the movie before it is mapped to its graphics world by applying the movie's matrix. The clipping region is in the movie's display coordinate system and is valid for the entire duration of the movie.

The GetMovieClipRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the function could not satisfy your request or if there is no clipping region defined for the movie, it sets the returned handle to nil .

The clipping region is saved with the movie when your application saves the movie.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors

SEE ALSO

You can set the clipping region by calling the SetMovieClipRgn function, which is described in the previous section.

SetTrackMatrix

The SetTrackMatrix function allows your application to establish a track's transformation matrix.

pascal void SetTrackMatrix (Track theTrack,
                                         const MatrixRecord *matrix);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

matrix
Contains a pointer to a matrix structure that contains the track's new matrix. If you set this parameter to nil , the Movie Toolbox uses the identity matrix.

DESCRIPTION

The Movie Toolbox uses a track's matrix to map a track from its own coordinate system into a movie's display coordinate system.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SEE ALSO

You can get a track's matrix with the GetTrackMatrix function, which is described in the next section.

The Movie Toolbox provides a number of functions that allow you to manipulate track matrices. See "Matrix Functions," for information about these functions.

GetTrackMatrix

The GetTrackMatrix function allows your application to retrieve a track's transformation matrix.

pascal void GetTrackMatrix (Track theTrack, MatrixRecord *matrix);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

matrix
Contains a pointer to a matrix structure. The GetTrackMatrix function returns the track's matrix into the structure referred to by this parameter.

DESCRIPTION

The Movie Toolbox uses a track's matrix to map a track from its own coordinate system into a movie's display coordinate system.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SEE ALSO

You can set a track's matrix with the SetTrackMatrix function, which is described in the previous section.

The Movie Toolbox provides a number of functions that allow you to manipulate track matrices. See "Matrix Functions" for information about these functions.

GetTrackBoundsRgn

The GetTrackBoundsRgn function allows the media to limit the size of the track boundary rectangle. Therefore, the region returned by GetTrackBoundsRgn may not be rectangular and may be smaller than the track boundary region.

pascal RgnHandle GetTrackBoundsRgn (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackBoundsRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the track does not have a spatial representation during the specified segment, the function returns an empty region. If the function could not satisfy your request, it sets the returned handle to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

Memory Manager errors

SEE ALSO

See the description of the base media handler component's MediaGetSrcRgn function in Inside Macintosh: QuickTime Components for details on how the media limits the size of the track boundary region.

SetTrackDimensions

The SetTrackDimensions function allows your application to establish a track's source, or display, rectangle.

pascal void SetTrackDimensions (Track theTrack, Fixed width,
                                         Fixed height);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

width
Contains a fixed-point number that specifies the width, in pixels, of the track's rectangle. This value corresponds to the x coordinate of the lower-right corner of the track's rectangle.

height
Contains a fixed-point number that specifies the height, in pixels, of the track's rectangle. This value corresponds to the y coordinate of the lower-right corner of the track's rectangle.

DESCRIPTION

A track's source rectangle defines the coordinate system of the track. You specify the dimensions of the rectangle by providing the coordinates of the lower-right corner of the rectangle. The Movie Toolbox sets the upper-left corner to (0,0) in the track's coordinate system.

If you change the dimensions of an existing track, the media data is scaled to fit into the new rectangle.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SEE ALSO

You can use the GetTrackDimensions function, which is described in the next section, to retrieve a track's rectangle.

GetTrackDimensions

The GetTrackDimensions function allows your application to determine a track's source, or display, rectangle.

pascal void GetTrackDimensions (Track theTrack, Fixed *width,
                                         Fixed *height);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

width
Contains a pointer to a fixed-point number. The Movie Toolbox returns the width, in pixels, of the track's rectangle. This value corresponds to the x coordinate of the lower-right corner of the track's rectangle.

height
Contains a pointer to a fixed-point number. The Movie Toolbox returns the height, in pixels, of the track's rectangle. This value corresponds to the y coordinate of the lower-right corner of the track's rectangle.

DESCRIPTION

A track's source rectangle defines the coordinate system of the track. You specify the dimensions of the rectangle by providing the coordinates of the lower-right corner of the rectangle. The Movie Toolbox sets the upper-left corner to (0,0) in the track's coordinate system.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SEE ALSO

You can use the SetTrackDimensions function, which is described in the previous section, to set a track's rectangle.

SetTrackClipRgn

The SetTrackClipRgn function allows your application to set the clipping region of a track.

pascal void SetTrackClipRgn (Track theTrack, RgnHandle theClip);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

theClip
Contains a handle to the track's clipping region. Note that the Movie Toolbox makes a copy of this region. Your application must dispose of the region referred to by this parameter when you are done with it. Set this parameter to nil to disable clipping for the track.

DESCRIPTION

The clipping region is in the track's coordinate system. The Movie Toolbox applies the clipping region to a track before it applies the track's matrix.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

Memory Manager errors

SEE ALSO

You can get a track's clipping region by calling the GetTrackClipRgn function, which is described in the next section.

GetTrackClipRgn

The GetTrackClipRgn function allows your application to determine the clipping region of a track.

pascal RgnHandle GetTrackClipRgn (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The clipping region is in the track's coordinate system. The Movie Toolbox applies the clipping region to a track before it applies the track's matrix. This region is valid for the entire duration of the track.

The GetTrackClipRgn function allocates the region and returns a handle to the region. Your application must dispose of this region when you are done with it. If the function could not satisfy your request or if there is no clipping region defined for the track, it sets the returned handle to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

Memory Manager errors

SEE ALSO

You can establish a track's clipping region by calling the SetTrackClipRgn function, which is described in the previous section.

SetTrackMatte

The SetTrackMatte function allows your application to set a track's matte. The matte defines which of the track's pixels are displayed in a movie. You must specify the matte in a pixel map structure.

pascal void SetTrackMatte (Track theTrack, PixMapHandle theMatte);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

theMatte
Contains a handle to the matte. The Movie Toolbox makes a copy of the matte, including its color table and pixels. Consequently, your application must dispose of the matte when you are done with it. Set this parameter to nil to remove the track's matte.

DESCRIPTION

The Movie Toolbox displays the weighted average of the track and its destination based on the corresponding pixel in the matte (this feature is fully functional in System 7 and is approximated in System 6).

SPECIAL CONSIDERATIONS

Note that the track matte must have its boundaries defined by the track rectangle.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

Memory Manager errors

SEE ALSO

You can retrieve a track's matte by calling the GetTrackMatte function, which is described in the next section. Listing 15 shows how to use the SetTrackMatte and GetTrackMatte functions to create a track matte.

GetTrackMatte

The GetTrackMatte function allows your application to retrieve a copy of a track's matte. The matte defines which of the track's pixels are displayed in a movie, and it is valid for the entire duration of the movie. This function returns the matte in a pixel map structure. You may use QuickDraw functions to manipulate the returned matte. However, you should use the Movie Toolbox's DisposeMatte function (described in the next section) to dispose of the matte when you are finished with it.

pascal PixMapHandle GetTrackMatte (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackMatte function returns a handle to the matte. Your application must dispose of this handle when you are done with it--you must use the DisposeMatte function, which is described in the next section, to dispose of the matte. If the function could not satisfy your request, it sets the returned handle to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

Memory Manager errors

SEE ALSO

You can establish a track's matte by calling the SetTrackMatte function, which is described in the previous section. Listing 15 shows how to use the SetTrackMatte and GetTrackMatte functions to create a track matte.

DisposeMatte

The DisposeMatte function disposes of a matte that you obtained from the GetTrackMatte function, which is described in the previous section.

pascal void DisposeMatte (PixMapHandle theMatte);
theMatte
Handle to the matte to be disposed. Your application obtains this handle from the GetTrackMatte function.

SPECIAL CONSIDERATIONS

You should not use this function to dispose of mattes or pixel maps that you obtain through other means.

ERROR CODES

None


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next